From 96fafda8f472c5d3452ba0d823476845f4efd1fb Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 6 Oct 2016 09:48:12 -0700 Subject: [PATCH] Fix Travis OSX They recently changed images, gotta tweak how we work with OpenSSL --- .travis.yml | 10 +++++++--- tests/cargotest/lib.rs | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2aef32ba6..731d1a5f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,9 +27,13 @@ env: - CARGOFLAGS=-j1 - secure: scGpeetUfba5RWyuS4yt10bPoFAI9wpHEReIFqEx7eH5vr2Anajk6+70jW6GdrWVdUvdINiArlQ3An2DeB9vEUWcBjw8WvuPtOH0tDMoSsuVloPlFD8yn1Ac0Bx9getAO5ofxqtoNg+OV4MDVuGabEesqAOWqURNrBC7XK+ntC8= -os: - - linux - - osx +matrix: + include: + - os: osx + rust: stable + before_install: + - export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include + - export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib branches: only: diff --git a/tests/cargotest/lib.rs b/tests/cargotest/lib.rs index ffd094f97..cc5b17cf0 100644 --- a/tests/cargotest/lib.rs +++ b/tests/cargotest/lib.rs @@ -22,6 +22,7 @@ use cargo::util::Rustc; use std::ffi::OsStr; use std::time::Duration; use std::path::PathBuf; +use std::env; pub mod support; pub mod install; @@ -40,7 +41,11 @@ pub fn is_nightly() -> bool { } pub fn process>(t: T) -> cargo::util::ProcessBuilder { - let mut p = cargo::util::process(t.as_ref()); + _process(t.as_ref()) +} + +fn _process(t: &OsStr) -> cargo::util::ProcessBuilder { + let mut p = cargo::util::process(t); p.cwd(&support::paths::root()) .env_remove("CARGO_HOME") .env("HOME", support::paths::home()) @@ -51,6 +56,35 @@ pub fn process>(t: T) -> cargo::util::ProcessBuilder { .env("GIT_CONFIG_NOSYSTEM", "1") // keep trying to sandbox ourselves .env_remove("CARGO_TARGET_DIR") // we assume 'target' .env_remove("MSYSTEM"); // assume cmd.exe everywhere on windows + + // We'll need dynamic libraries at some point in this test suite, so ensure + // that the rustc libdir is somewhere in LD_LIBRARY_PATH as appropriate. + // Note that this isn't needed on Windows as we assume the bindir (with + // dlls) is in PATH. + if cfg!(unix) { + let var = if cfg!(target_os = "macos") { + "DYLD_LIBRARY_PATH" + } else { + "LD_LIBRARY_PATH" + }; + let rustc = RUSTC.with(|r| r.path.clone()); + let path = env::var_os("PATH").unwrap_or(Default::default()); + let rustc = env::split_paths(&path) + .map(|p| p.join(&rustc)) + .find(|p| p.exists()) + .unwrap(); + let mut libdir = rustc.clone(); + libdir.pop(); + libdir.pop(); + libdir.push("lib"); + let prev = env::var_os(&var).unwrap_or(Default::default()); + let mut paths = env::split_paths(&prev).collect::>(); + println!("libdir: {:?}", libdir); + if !paths.contains(&libdir) { + paths.push(libdir); + p.env(var, env::join_paths(&paths).unwrap()); + } + } return p } -- 2.30.2